# @Filename:    Sample1-add
# @Author:      王佳伟
# @Time:        2025-02-28 9:25
# @Describe:    计算两个日期之间的天数差
import unittest
from datetime import datetime


def days_between_dates(date1, date2):
    delta = abs((date2 - date1).days)
    return delta


class TestDaysBetweenDates(unittest.TestCase):
    def test_days_between_dates(self):
        date1 = datetime(2023, 1, 1)
        date2 = datetime(2023, 1, 5)
        self.assertEqual(days_between_dates(date1, date2), 4)
        date3 = datetime(2023, 1, 10)
        self.assertEqual(days_between_dates(date2, date3), 5)


if __name__ == '__main__':
    unittest.main()
